package com.conn;

import com.conn.*;

import org.w3c.dom.*;

public class Parser1 extends Parser {
    public RegisterInfo registerUnpack(byte[] data, int len) {
        RegisterInfo ri = new RegisterInfo();
        Document doc = XmlHelper1.genDocFromStream(data, len);
        ri.username = XmlHelper1.getItemValue(doc, "username", 0);
        ri.passwd = XmlHelper1.getItemValue(doc, "passwd", 0);
        ri.email = XmlHelper1.getItemValue(doc, "email", 0);
        ri.name = XmlHelper1.getItemValue(doc, "name", 0);
        ri.sex = XmlHelper1.getItemValue(doc, "sex", 0);
        ri.birthday = XmlHelper1.getItemValue(doc, "birthday", 0);
        ri.phone = XmlHelper1.getItemValue(doc, "phone", 0);
        ri.country = XmlHelper1.getItemValue(doc, "country", 0);
        ri.home = XmlHelper1.getItemValue(doc, "home", 0);

        return ri;
    }
    public Command getCommandId(byte[] data, int len) {
        Document doc = XmlHelper1.genDocFromStream(data, len);
        String id = XmlHelper1.getItemValue(doc, "id", 0);
        return Command.valueOf(id);
    }
}
